<template>
    <div class="modal-backdrop" v-show="show" @click="_close">
        <div class="modal">
            <div class="confirm-dialog" @click.stop="_touch">
                <img class="dialog-close" src="../assets/images/ic_close.png" @click.stop="_close"/>

                <span class="dialog-tip">{{tip}}</span>

                <span class="dialog-button dialog-button-negative" @click.stop="_close">取消</span>

                <span class="dialog-button dialog-button-positive" @click.stop="_confirm">确认</span>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'confirmDialog',
        props: {
            show: Boolean,
            tip: String
        },
        methods: {
            _close() {
                this.$emit('close')
            },
            _touch() {

            },
            _confirm() {
                this.$emit('confirm')
            }
        }
    };
</script>
<style lang="less" scoped>
    .modal-backdrop {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background-color: rgba(0, 0, 0, .3);
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .modal {
        background-color: transparent;
        box-shadow: 2px 2px 20px 1px;
        overflow-x: auto;
        display: flex;
        flex-direction: column;
        border-radius: 20px;
    }

    .confirm-dialog {
        width: 600px;
        height: 230px;
        background-color: rgb(12, 12, 63);
        box-sizing: border-box;
        border-width: 2px;
        border-style: solid;
        border-color: rgba(89, 229, 254, 1);
        border-radius: 20px;
        position: relative;
    }

    .dialog-close {
        position: absolute;
        right: 20px;
        top: 15px;
        width: 37px;
        height: 37px;
    }

    .dialog-tip {
        position: absolute;
        top: 50px;
        left: 0;
        right: 0;
        font-weight: 600;
        font-style: normal;
        font-size: 28px;
        color: #59E5FE;
        text-align: center;
    }

    .dialog-button {
        position: absolute;
        bottom: 40px;
        width: 230px;
        height: 60px;
        line-height: 60px;
        text-align: center;
        font-size: 24px;
    }

    .dialog-button-negative {
        border-width: 1px;
        border-style: solid;
        border-color: rgba(89, 229, 254, 1);
        border-radius: 8px;
        color: #59E5FE;
        left: 50px;
    }

    .dialog-button-positive {
        background-color: rgba(89, 229, 254, 1);
        border: none;
        border-radius: 8px;
        color: #0C0C3F;
        right: 40px;
    }
</style>
